import React, { PureComponent, Fragment } from 'react';
import { connect } from 'dva';
import { Form } from '@ant-design/compatible';
import '@ant-design/compatible/assets/index.css';
import { Tabs, Modal, Select } from 'antd';
import 'moment/locale/zh-cn';
import { SecondHeaderC } from '../../../comps';
import LimitDetailTableC from '../limitDetailTable';
import myStyle from './index.less';

@Form.create()
export default class myModal extends PureComponent {
  state = {
    tableRolData: {},
  };

  componentDidMount() {}

  render() {
    const { record, timeStamp, type } = this.props;
    const dom = document.querySelector('.limitDetail .ant-modal-body');
    const scrollHeight = dom ? (record.controlMethod == 2 ? dom.offsetHeight - 205 : dom.offsetHeight - 180) : '100%';
    return (
      <div>
        <p title={record.ruleDesc}>风险说明：{record.ruleDesc}</p>
        <p>触警次数：{record.numberOfAlarms != null ? `${record.numberOfAlarms}次` : '--'}</p>
        <SecondHeaderC title='明细结构' />
        {record.controlMethod == 2 ? (
          <div className='total_row'>
            <span>触警值：{record.warningValue || '--'}</span>
            <span>禁止值：{record.prohibitValue || '--'}</span>
            <span>剩余值：{record.marginValue || '--'}</span>
          </div>
        ) : null}
        <div>
          <LimitDetailTableC timeStamp={timeStamp} isRed={false} url={type != 'report' ? 'getDetails' : 'queryReportInfoById'} scrollHeight={scrollHeight} search={record} />
        </div>
      </div>
    );
  }
}
